<template>
	<view class="bgWhite ">

		<view class="header" :style="'margin-top:'+menuTop+'px;height:'+menuHeight+'px'">
			首页
		</view>
		<view class="header plr10 " :style="'height:340rpx;'">
			<swiper class="swiper" circular indicator-active-color="#277CC0" :indicator-dots="indicatorDots" style="text-align:center;height:340rpx;" 
				:autoplay="autoplay" :interval="interval" :duration="duration">
                
				<swiper-item  v-for="(i,n) in imgList" :key="n" style="text-align:center;width: 100%;height: 340rpx;" >
					<image :src="$domain.api+i.img_url" style="width: 100%;height: 340rpx;" mode=""></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="content bg100 plr15 pb50">
			<view class="vipName">
				会员权益
			</view>
			<view class="plr25 justify-between align-center">
				<view class="nav" @click="tourl('/pages/openVip/index')">
					 <view class="mb10 align-center justify-center">
					 	<image src="/static/images/vip.png" mode="widthFix"></image>
					 </view>
					 加入会员
				</view>
				<view class="nav" @click="toArtCate(1)">
					 <view class="mb10 align-center justify-center" style="background-color: #1D2D5F;">
					 	<image src="/static/images/join.png" mode="widthFix"></image>
					 </view>
					 活动报名
				</view>
				<view class="nav" @click="tourl('/pages/artApply/index')">
					 <view class="mb10 align-center justify-center" style="background-color: #FFBC47;">
					 	<image src="/static/images/hz.png" mode="widthFix"></image>
					 </view>
					 合作对接
				</view>
			</view>
			<view class="moduleTitle align-center  "> <text class="hb"></text>
				<view class="flex1">
					活动论坛
				</view> <text @click="toArtCate(1)">更多精选</text>
			</view>
			<act-item :datas="activities"></act-item>
			<view class="moduleTitle align-center  "> <text class="hb"></text>
				<view class="flex1">
					会员报告
				</view> <text @click="toArtCate(2)">更多精选</text>
			</view>
		<!-- 	<view class="justify-between flex-wrap">
				<view class="reportModule mb10">
					研究报告<text style="color: #3662EC;">77</text>份
				</view>
				<view class="reportModule mb10">
					活动课件<text style="color: #3662EC;">13</text>份
				</view>
				<view class="reportModule ">
					老年消费<text style="color: #3662EC;">53</text>份
				</view>
				<view class="reportModule ">
					文娱旅游<text style="color: #3662EC;">87</text>份
				</view>

			</view> -->
			<!-- <uv-tabs style="width: 700rpx;" :line-color="'#0368FF'" :activeStyle="{
				color: '#0368FF',
				fontWeight: 'bold',
				transform: 'scale(1.05)'
			}"
			:inactiveStyle="{
				color: '#303133',
				transform: 'scale(1)'
			}"  :list="list" @change="click"></uv-tabs>
			<view class="" style="height: 30rpx;">
				
			</view> -->
			<report-item   :datas="reports"></report-item>
			<view class="moduleTitle align-center  "> <text class="hb"></text>
				<view class="flex1">
					合作对接
				</view> <text @click="toArtCate(3)">更多精选</text>
			</view>
			<people-item :datas="coops"></people-item>  
		</view>
		
	</view>
</template>

<script>
	import actItem from '@/components/actItem.vue';
	import reportItem from '../../components/reportItem.vue';
	import peopleItem from '@/components/peopleItem.vue'
	export default {
		components: {
			actItem,
			reportItem,
			peopleItem
		},
		data() {
			return {
				menuTop: uni.getStorageSync('menuInfo').menuTop,
				menuHeight: uni.getStorageSync('menuInfo').menuHeight,
				dataList: [{},
					{}
				],
				imgList:[],
				activities:[],
				coops:[],
				reports:[],
				
				list:[{
					name:'全部城市'
				}],

			}
		},
		onLoad() {
				
			this.$api.getIndex().then(res=>{
				console.log(res)
				this.reports=res.reports
				this.activities=res.activities
				this.coops=res.coops
			})
			this.$api.getCityList().then(res=>{
				console.log(res)
				res.data.map(item=>{
					this.list.push({
						name:item
					})
				})
				
			})
			this.$api.slideImage().then(res=>{
				console.log(res)
				this.imgList =res.data
			
			})
			
			// this.getList()
			// this.getList1()
			// this.getList2()

			//          this.$api.swiperList().then(res=>{
			//              console.log(res)
			//              this.imgList= res.data
			//          })
		},
		onShareAppMessage: function() {
			let that = this;
			wx.showShare1Menu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline']
			});
			return {
				title: '老年学会',
				imageUrl: '',
				path: '/pages/tabbar/index'
			};
		},
		onShareTimeline: function() {
			let that = this;
			return {
				title: '老年学会',
				imageUrl: '',


			};
		},
		methods: {
			
			toUserList() {
				uni.navigateTo({
					url: '/pages/artist/index'
				})
			},
			toAct() {
				uni.navigateTo({
					url: '/pages/activity/index'
				})
			},
			toBooking() {
				uni.switchTab({
					url: '/pages/tabbar/chat'
				})
			},
			toApply() {
				uni.navigateTo({
					url: '/pages/artApply/index'
				})
			},
			async getCate() {
				const {
					data,
					code
				} = await this.$api.CategoryList()
				uni.hideLoading()
				if (code == 200) {
					this.list = data
					// this.categoryId =data[0].id

					// this.getList()
				}
			},
			async getList() {
				const {
					data,
					code
				} = await this.$api.activityList({
					categoryId: 1
				})
				console.log(code, data)
				if (code == 200) {
					this.gyList = data
				}
			},
			async getList1() {
				const {
					data,
					code
				} = await this.$api.activityList({
					categoryId: 2
				})
				console.log(code, data)
				if (code == 200) {
					this.yhList = data
				}
			},
			async getList2() {
				const {
					data,
					code
				} = await this.$api.activityList({
					categoryId: 3
				})
				console.log(code, data)
				if (code == 200) {
					this.orderList = data
				}

			},

			toArticleMain(i) {
				uni.navigateTo({
					url: '/pages/article/index?id=' + i.id
				})
			},
			toMain(item) {
				uni.navigateTo({
					url: '/pages/actMain/index?id=' + item.id
				})
			},
			toArtCate(index) {
				
				switch(index){
					case 1:
					uni.switchTab({
						url:'/pages/activity/index'
					})
					break;
					case 2:
					uni.navigateTo({
						url:'/pages/reportList/index'
					})
					break;
					case 3:
					uni.switchTab({
						url:'/pages/company/index'
					})
					break;
				}
			},
			tourl(url){
				
					uni.navigateTo({
						url:url
					})
			},
			change(data) {
				uni.navigateTo({
					url: '/pages/addressMain/index?id=' + data
				})
			}
		},


	}
</script>
<style scoped lang="scss">
	.content {

		position: relative;
		z-index: 99;
	}

	.header {
		font-size: 36rpx;
		font-weight: 600;
		color: #000;
		padding-left: 20rpx;
	}

	.moduleTitle {

		font-weight: 500;
		font-size: 36rpx;
		color: #3D3D3D;
		margin: 54rpx auto 46rpx;
		text-align: left;
		position: relative;

		text {
			font-size: 28rpx;
			color: #0368FF;
			font-weight: 400;
		}

		.hb {
			display: block;
			width: 8rpx;
			height: 28rpx;
			margin-right: 20rpx;
			background: #0368FF;
		}
	}
	.vipName{
		font-weight: 600;
		font-size: 34rpx;
		color: #3D3D3D;
		margin-bottom: 44rpx;
	}
	.nav{
		view{
			color: #3D3D3D;
			font-size: 30rpx;
				image{
					width: 52rpx;
					
				}
				width: 96rpx;
				height: 96rpx;
				background:#F65E5D;
				border-radius: 60rpx ;
		}
		
	}
	.reportModule{
		width: 336rpx;
		height: 70rpx;
		font-size: 28rpx;
		color: #3D3D3D;
		text-align: center;
		line-height: 70rpx;
		background: #F7F7F7;
	}
</style>